using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.RepositoryFactory.CodeGeneration.ObjectModel.Mappings.Enums;
using Microsoft.Practices.RepositoryFactory.CodeGeneration.ObjectModel.NamingConventions;
using Microsoft.Practices.RepositoryFactory.SchemaDiscovery.ObjectModel.Base;

namespace Microsoft.Practices.RepositoryFactory.CodeGeneration.ObjectModel.Mappings
{
    /// <summary/>
    public class TableStoredProcedureMapping
    {
        #region Properties
        private StoredProcedureType type;

        /// <summary>
        /// Gets or sets the type.
        /// </summary>
        /// <value>The type.</value>
        public StoredProcedureType Type
        {
            get { return type; }
            set { type = value; }
        }

        private string name;

        /// <summary>
        /// Gets or sets the name.
        /// </summary>
        /// <value>The name.</value>
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private bool codeGenerationEnabled;

        /// <summary>
        /// Gets or sets a value indicating whether [code generation enabled].
        /// </summary>
        /// <value>
        /// 	<c>true</c> if [code generation enabled]; otherwise, <c>false</c>.
        /// </value>
        public bool CodeGenerationEnabled
        {
            get { return codeGenerationEnabled; }
            set { codeGenerationEnabled = value; }
        } 

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="T:TableStoredProcedureMapping"/> class.
        /// </summary>
        /// <param name="table">The table.</param>
        /// <param name="type">The type.</param>
        public TableStoredProcedureMapping(Table table, StoredProcedureType type)
        {
            this.type = type;
            this.name = NamingHelper.GetSPName(table, type);
            this.codeGenerationEnabled = true;
        }

        #endregion
    }
}